/*
 */
package org.hook.showcase.concurrent.visibility;

import net.jcip.annotations.NotThreadSafe;

/**
 * @author suwuqiang 2011-12-5
 */
@NotThreadSafe
public class NoVisibility {
	private static boolean ready;
	private static int number;

	private static class ReaderThread extends Thread {
		@Override
		public void run() {
			while (!ready) // 可能会出现过期数据：ready
				Thread.yield();
			System.out.println(number);
		}
	}

	public static void main(String[] args) {
		new ReaderThread().start();
		ready = true;
		number = 5;
	}
}
